<!DOCTYPE html>
<html>
<head>
  <title>jquery.inview - Example</title>
  <meta name="viewport" content="initial-scale=1.0, width=device-width, height=device-height">
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
  <script src="../jquery.inview.js"></script>
  <style>
    body {
      font-family: Arial, Verdana, sans-serif;
      font-size: 12px;
    }
    #top-right, #bottom-left {
      position: absolute;
      border: 5px solid red;
      color: red;
      font-weight: bold;
      padding: 10px;
      opacity: 0;
      margin: 10px;
    }
    #top-right {
      left: 3000px;
      top: 0;
    }
    #bottom-left {
      top: 3000px;
      left: 0;
    }
  </style>
</head>
<body>
  <h1>jquery.inview - Example</h1>
  <p>Scroll to the <a href="#top-right">right</a> and to the <a href="#bottom-left">bottom</a></p>

  <span id="top-right">visible!</span>
  <span id="bottom-left">visible!</span>

  <script>
    $('#top-right, #bottom-left').bind('inview', function(event, visible) {
      if (visible) {
        $(this).stop().animate({ opacity: 1 });
      } else {
        $(this).stop().animate({ opacity: 0 });
      }
    });
  </script>
</body>
</html>